nums = [3, 2, 2, 3]
val = 3

# 不能使用额外的数组空间
# 使用双指针
i = 0
for j in range(len(nums)):
    if nums[j] != val:
        nums[i] = nums[j]
        i = i + 1

for k in range(i):
    print(nums[k], end=" ")
